# 定义谜题字典，每个谜题包含问题、答案和提示
puzzles = {
    1: {
        "question": "什么东西越洗越脏，不洗有人吃，洗了没人吃？",
        "answer": "水",
        "hint": "生活中常见的液体"
    },
    2: {
        "question": "什么东西晚上才生出尾巴呢？",
        "answer": "流星",
        "hint": "在夜空中偶尔能看到的天文现象"
    },
    3: {
        "question": "什么东西明明是你的，别人却用得比你还多呢？",
        "answer": "名字",
        "hint": "每个人都有的标识"
    }
}

# 初始化当前谜题编号和剩余提示次数
current_puzzle = 1
hint_count = 3

print("欢迎来到解密游戏！你需要解开一系列谜题来通关。")

while current_puzzle <= len(puzzles):
    puzzle = puzzles[current_puzzle]
    print(f"\n谜题 {current_puzzle}: {puzzle['question']}")
    while True:
        user_answer = input("请输入你的答案（输入 '提示' 可获取提示，输入 '退出' 结束游戏）：")
        if user_answer == "退出":
            print("游戏结束，期待下次挑战！")
            break
        elif user_answer == "提示":
            if hint_count > 0:
                print(f"提示：{puzzle['hint']}")
                hint_count -= 1
            else:
                print("你已经用完了所有提示次数。")
        elif user_answer == puzzle["answer"]:
            print("回答正确！恭喜你解开了这个谜题。")
            current_puzzle += 1
            break
        else:
            print("回答错误，请再试一次。")
    if user_answer == "退出":
        break

if current_puzzle > len(puzzles):
    print("\n恭喜你，成功解开所有谜题，通关游戏！")